<?php

require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../Mqtt.php';

$mqtt = new Mqtt;
$mqtt->createChannel();
$mqtt->createExchange('test-exchange', 'fanout');

$i = 1;
while(true) {
    $msg = "hello,mqtt_{$i}\n";
    $mqtt->publishMsg($msg);
    echo $msg;
    $i++;

    sleep(1);
}

$mqtt->close();